/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wa.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;

/**
 *
 * @author twh
 */
@Entity
@NamedQuery(name="findAllArtifacts", query = "SELECT a FROM Artifact a")
public class Artifact {

    @Id @GeneratedValue
    private Long id;

    @Column(nullable = false)
    private String name;
    private String lang;
    private int votecount;
    private int  hitcount;

    private String release;
    private String shortDescription;
    private String debugInfo;
    
    @OneToOne
    private Artifact parent;

    @Column(nullable = false)
    private ArtifactType type;

    @ManyToOne 
    private User createdBy;
    @ManyToOne 
    private User modifiedBy;
    
    public User getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(User createdBy) {
        this.createdBy = createdBy;
    }

    public User getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }
    
    // parent
    // created user
    // modified user
    // raritytype -> enumeration
    // files
    // personenrollen
    // supportedhardware



    public String getDebugInfo() {
        return debugInfo;
    }

    public void setDebugInfo(String debugInfo) {
        this.debugInfo = debugInfo;
    }

    public int getHitcount() {
        return hitcount;
    }

    public void setHitcount(int hitcount) {
        this.hitcount = hitcount;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRelease() {
        return release;
    }

    public void setRelease(String release) {
        this.release = release;
    }

    public String getShortDescription() {
        return shortDescription;
    }

    public void setShortDescription(String shortDescription) {
        this.shortDescription = shortDescription;
    }

    public int getVotecount() {
        return votecount;
    }

    public void setVotecount(int votecount) {
        this.votecount = votecount;
    }

    public ArtifactType getType() {
        return type;
    }

    public void setType(ArtifactType type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "Name:"+getName()+ " (ID:"+getId()+")";
    }

	public void setParent(Artifact parent) {
		this.parent = parent;
	}

	public Artifact getParent() {
		return parent;
	}
}
